<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<link rel="stylesheet" type="text/css" href="css/WeVal_Master_CSS.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script language="javascript" type="text/javascript" src="javascripts/teacher-dashboard.js"></script>
	<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">

function bindButtons()
{

  $(".button").click(function(){

		$(this).val("-");

    $(this).siblings(".toggleOpen").toggle();
 });
}
</script>

<script type="text/javascript">
	$("#StatisticsWrapper").before('<img id="loadinggif" src="http://usa.d-mpro.com/Assets/images/loadinglogin.gif" />');
	function getPixelLength(score)
	{
		var result = 0;
		result = score/4.00;
		result = 400*result;
		return result;
	}
	function getPixelLengthBasic()
	{
		var result = [];
		result.push(getAnswerLength(window.currentSD));
		result.push(getAnswerLength(window.currentD));
		result.push(getAnswerLength(window.currentN));
		result.push(getAnswerLength(window.currentA));
		result.push(getAnswerLength(window.currentSA));
		
		return result;		
	}
	function getAnswerLength(answerCount)
	{
		if(answerCount == 0 || window.currentTotal == 0)
		{
			return 0;
		}
		var returnValue = ((answerCount/window.currentTotal) * window.totalBarLength);
		return returnValue;
	}
	function appendQuestion()
	{
		var buildString = '<div class="question_box"><button class="button">+</button><div class="toggle">';
		buildString += '<div class="question">'+window.currentQuestion+'</div><div class="question_graph">';
		buildString += '<div class="graph_box graphStronglyDisagree" style=" width:'+window.currentLengths[0]+'px;">';
		buildString += '</div><div class="graph_box graphDisagree" style=" width:'+window.currentLengths[1]+'px;">';
		buildString += '</div><div class="graph_box graphNeutral" style=" width:'+window.currentLengths[2]+'px;">';
		buildString += '</div><div class="graph_box graphAgree" style=" width:'+window.currentLengths[3]+'px;">';
		buildString += '</div><div class="graph_box graphStronglyAgree" style=" width:'+window.currentLengths[4]+'px;">';
		buildString += '</div></div><table class="question_scores"><tr><td class="question_answers_collapsed">SD: '+window.currentSD+'</td>';
		buildString += '<td class="question_answers_collapsed">D: '+window.currentD+'</td>';
		buildString += '<td class="question_answers_collapsed">N: '+window.currentN+'</td>';
		buildString += '<td class="question_answers_collapsed">A: '+window.currentA+'</td>';
		buildString += '<td class="question_answers_collapsed">SA: '+window.currentSA+'</td>';
		buildString += '</tr></table><br/></div><div class="toggleOpen">TEST</div></div>';			
		
	
		$("#questions_wrapper").append( buildString);	
		
	}
	function mainQuery(crn, semester, year)
	{
		jQuery.get('https://chitester1dev.weber.edu:6838/misc/weber/CSEvals/AnswerCount.cfm?crn='+crn+'&semester='+semester+'&year='+year, function(data) {

			$.each(data.DATA, function(i,array) {
					window.currentQuestion = array[2];
					$.each(data.DATA, function(i,innerArray){
						if(window.currentQuestion == innerArray[2] && window.finishedQuestions.indexOf(window.currentQuestion + " - " + innerArray[3]) == -1)
						{
							switch(innerArray[3])
							{
								case 'strongly disagree' :
								case 'very poor' :
									window.currentSD+= +innerArray[4];
									window.currentTotal+= +innerArray[4];
									break;
								case 'disagree' :
								case 'poor' :
									window.currentD+= +innerArray[4];
									window.currentTotal+= +innerArray[4];					
									break;
								case 'neutral' :
								case 'average' :
									window.currentN+= +innerArray[4];
									window.currentTotal+= +innerArray[4];
									break;
								case 'agree' :
								case 'good' :
									window.currentA+= +innerArray[4];
									window.currentTotal+= +innerArray[4];
									break;					
								case 'strongly agree' :
								case 'excellent' :
									window.currentSA+= +innerArray[4];
									window.currentTotal+= +innerArray[4];
									break;
							}
							
							window.finishedQuestions.push(window.currentQuestion + " - " + innerArray[3]);
		
						}
					});
					
					if(window.printedQuestions.indexOf(window.currentQuestion) == -1)
					{
						window.currentLengths = getPixelLengthBasic();
						window.printedQuestions.push(window.currentQuestion);
						$("#array").append('<p style="clear:both;">' + window.currentQuestion + " - " + window.currentSD + " - " + window.currentD + " - "  + window.currentN + " - " + window.currentA +" - " + window.currentSA +" - " + window.currentTotal + "</p><br>" );
						
						appendQuestion();

					}
					window.currentQuestion = " ";
					window.currentSD = 0;
					window.currentD = 0;
					window.currentN = 0;
					window.currentA = 0;
					window.currentSA = 0;
					window.currentTotal = 0;
						
			});
		}).success(function(){bindButtons();});
	
	
	
	}
	
	var CRN = 30594;
	var Semester = 3;
	var Year = 2013;
	
	var totalBarLength = 400;
	var currentQuestion = " ";
	var currentSD = 0;
	var currentD = 0;
	var currentN = 0;
	var currentA = 0;
	var currentSA = 0;
	var currentTotal = 0;
	var currentLengths = [ ];
	var finishedQuestions = [ ];
	var printedQuestions = [ ];
	function topQuery(crn,semester,year)
	{
		jQuery.get('https://chitester1dev.weber.edu:6838/misc/weber/CSEvals/CrnStatistics.cfm?crn='+crn+'&semester='+semester+'&year='+year, function(data) {
			$.each(data.DATA, function(i,array) {
				$("#StatisticsWrapper").append('		<table style="top_table_settings" align="center"><tr><td style="width: 40px"></td><td style="width: 300px;"></td><td></td><td></td><td style="max-width:100px;text-align:center;">Standard Deviation</td></tr><tr><td style="width: 40px"><div class="expander"><div class="minus">-</div></div></td><td class="bigger bolder" style="width: 300px;">Your Overall Score</td><td class="bigger bolder" style="width: 60px">'+Number(array[7]).toFixed(2)+'</td><td><div class="container ticks"><div class="overall_ bigbar yellow ticks" style="width:'+getPixelLength(array[7])+'px;"></div></div></td><td style="width: 100px;">'+Number(array[8]).toFixed(2)+'</td></tr></table>');
	
				
				$("#StatisticsWrapper").append('<table style="top_table_settings" class="border spacing" align="center"><tr><td style="width: 40px;"></td><td style="width: 300px;">Method Subscore (Q:1-4)</td><td style="width: 60px;">'+Number(array[0]).toFixed(2)+'</td><td><div class="container"><div class="overall_bar yellow" style="width:'+getPixelLength(array[0])+'px;"></div></div></td><td style="width: 100px;">Fix Me</td></tr><tr><td style="width: 40px;"></td><td style="width: 300px;">Instructor Subscore (Q:5-11)</td><td style="width: 60px;">'+Number(array[1]).toFixed(2)+'</td><td><div class="container"><div class="overall_bar yellow" style="width:'+getPixelLength(array[1])+'px"></div></div></td><td style="width: 100px;">Fix Me</td></tr><tr><td style="width: 40px;"></td><td style="width: 300px;">Content Subscore (Q:12-15)</td><td style="width: 60px;">'+Number(array[2]).toFixed(2)+'</td><td><div class="container"><div class="overall_bar yellow" style="width:'+getPixelLength(array[2])+'px"></div></div></td><td style="width: 100px;">Fix Me</td></tr><tr class="gap"><td style="width: 40px;"></td><td style="width: 300px;">Your Overall Semester Average</td><td style="width: 60px;">'+Number(array[3]).toFixed(2)+'</td><td><div class="container"><div class="overall_bar " style="width:'+getPixelLength(array[3])+'px"></div></div></td><td style="width: 100px;">'+Number(array[4]).toFixed(2)+'</td></tr><tr><td style="width: 40px;"></td><td style="width: 300px;">Departmental Semester Average</td><td style="width: 60px;">'+Number(array[5]).toFixed(2)+'</td><td><div class="container"><div class="overall_bar" style="width:'+getPixelLength(array[5])+'px"></div></div></td><td style="width: 100px;">'+Number(array[6]).toFixed(2)+'</td></tr><tr><td style="width: 40px;"></td><td style="width: 300px;">Deparmental CS 1400 5 Year Average</td><td style="width: 60px;">Fix Me</td><td><div class="container"><div class="overall_bar" style="width:333"></div></div></td><td style="width: 100px;">Fix Me</td></tr><tr><td style="width: 40px;"></td><td style="width: 300px;">Your CS 1400 5 Year Average</td><td style="width: 60px;">Fix Me</td><td ><div class="container"><div class="overall_bar" style="width:270"></div></div></td><td style="width: 100px;">Fix Me</td></tr><tr><td class="bolder" colspan="5">FIX THIS A score of 3.92 places you in the 90th percentile of your department this semester.</td></tr></table>');
					
				$("#loadinggif").remove();

			});
		});
	}
	
	window.onload=(function() {
		$("#StatisticsWrapper").before('<img id="loadinggif" src="http://www.familytv.com/App_Support/Images/default/Loading_White.gif" "/>');
		mainQuery(CRN,Semester,Year);	
		topQuery(CRN,Semester,Year);
	});
	


	
</script>
</head>
<body class="body">
 <div class="wrapper">
 	<div class="header">
 		<a href="teacher-dashboard.html"><img src="images/wevallogo.png" alt="Logo"/></a>	
		<div class="filter">
			<form name="input" action="" method="">
				<select id="courseInstructor">
					<option value="teacherName">Brad Peterson</option>
				</select>			
				<select id="semester">
					<option value="semester1">Summer 2013</option>
					<option value="semester2">Spring 2013</option>
					<option value="semester3">Fall 2012</option>
				</select>
				<select id="course">
					<option value="course1">CS4790</option>
					<option value="course2">CS4110</option>
					<option value="course3">CS4800</option>
				</select>				
				
				<input type="submit" value="Submit">
			</form>	
		</div>
 	</div>
	
    <div class="bar_header"><hr></div>

	<div class="expand_all">
		<table>	
			<tr>
				<td><input id="expandAllQuestions" type="checkbox"></td>				
				<td>expand all</td>
			</tr>
		</table>
	</div>
	
	<div class="title">Course Evaluation - CS1400 67877 Spr 2013</div>
	
		<div id="StatisticsWrapper">
		
	
	
	
	</div>
	
	<div class="bar_divider"><hr></div>
	
	<div class="legend_box">
	
		<div class="legend_graph">
	
				<div class="graph_box graphStronglyDisagree">Strongly Disagree</div>	
				<div class="graph_box graphDisagree">Disagree</div>
				<div class="graph_box graphNeutral">Neutral</div>
				<div class="graph_box graphAgree">Agree</div>
				<div class="graph_box graphStronglyAgree">Strongly<br/> Agree</div>					
				
		</div>
		
	</div>
	<div id="questions_wrapper"></div>
	<div class="question_box">
		
		<div class="expander"><div class="minus">-</div></div>
			
		<table class="table_settings" border="0">			
			<tr>	
				<td colspan="6">
					<div class="question">
							Course objectives were clearly communicated
					</div>
				<td>
			</tr>
			
			<tr>
				<td align='left' width='225px'> </td>
				<td align='left' width='47' class="">SD</td>	
				<td align='left' width='47' class="">D</td>
				<td align='left' width='47' class="">N</td>
				<td align='left' width='47' class="">A</td>
				<td align='left' width='47' class="">SA</td>	
				<td align='left'></td>
			</tr>
						
			<tr>
				<td align='left' width='225px'> </td>
				<td align='left' width='47'>8</td>	
				<td align='left' width='47'>3</td>
				<td align='left' width='47'>6</td>
				<td align='left' width='47'>3</td>
				<td align='left' width='47'>2</td>	
				<td align='left' rowspan="2"> 
				
				<div>
						<div class="graph_box graphStronglyDisagree"></div>	
						<div class="graph_box graphDisagree"></div>
						<div class="graph_box graphNeutral"></div>
						<div class="graph_box graphAgree"></div>
						<div class="graph_box graphStronglyAgree"></div>				
				</div>
				
				</td>
			</tr>							
			<tr>
				<td align='left' width='225px'> </td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	

			</tr>	
			
			<tr>
				<td align='left' width='100px'>Dpt Average This Semester</td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	
				<td align='left'> 
				
					<div>
							<div class="graph_box_expanded graphStronglyDisagreeExpanded"></div>	
							<div class="graph_box_expanded graphDisagreeExpanded"></div>
							<div class="graph_box_expanded graphNeutralExpanded"></div>
							<div class="graph_box_expanded graphAgreeExpanded"></div>
							<div class="graph_box_expanded graphStronglyAgreeExpanded"></div>				
					</div>
				
				</td>
			</tr>
			
			<tr>
				<td align='left' width='100px'>Your Overall Semester Average</td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	
				<td align='left'> 
				
					<div>
							<div class="graph_box_expanded graphStronglyDisagreeExpanded"></div>	
							<div class="graph_box_expanded graphDisagreeExpanded"></div>
							<div class="graph_box_expanded graphNeutralExpanded"></div>
							<div class="graph_box_expanded graphAgreeExpanded"></div>
							<div class="graph_box_expanded graphStronglyAgreeExpanded"></div>				
					</div>
				
				</td>
			</tr>	
				
			<tr>
				<td align='left' width='100px'>Dpt CS 1400 5 Year Average</td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	
				<td align='left'> 
				
					<div>
							<div class="graph_box_expanded graphStronglyDisagreeExpanded"></div>	
							<div class="graph_box_expanded graphDisagreeExpanded"></div>
							<div class="graph_box_expanded graphNeutralExpanded"></div>
							<div class="graph_box_expanded graphAgreeExpanded"></div>
							<div class="graph_box_expanded graphStronglyAgreeExpanded"></div>				
					</div>
				
				</td>
			</tr>
			
			<tr>
				<td align='left' width='100px'>Your CS 1400 5 Year Average</td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	
				<td align='left'> 
				
					<div>
							<div class="graph_box_expanded graphStronglyDisagreeExpanded"></div>	
							<div class="graph_box_expanded graphDisagreeExpanded"></div>
							<div class="graph_box_expanded graphNeutralExpanded"></div>
							<div class="graph_box_expanded graphAgreeExpanded"></div>
							<div class="graph_box_expanded graphStronglyAgreeExpanded"></div>				
					</div>
				
				</td>
			</tr>	
			
			<tr>
				<td align='left' width='100px'>College Average Spring 2013</td>
				<td align='left' width='47'>8%</td>	
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>6%</td>
				<td align='left' width='47'>3%</td>
				<td align='left' width='47'>2%</td>	
				<td align='left'> 
				
					<div>
							<div class="graph_box_expanded graphStronglyDisagreeExpanded"></div>	
							<div class="graph_box_expanded graphDisagreeExpanded"></div>
							<div class="graph_box_expanded graphNeutralExpanded"></div>
							<div class="graph_box_expanded graphAgreeExpanded"></div>
							<div class="graph_box_expanded graphStronglyAgreeExpanded"></div>				
					</div>
				
				</td>
			</tr>		
									
		</table>				
	</div>
		<div class="bar_divider"><hr></div>
	
	<div class="question_box">
		<table class="essay_table_settings">
			<tr>
				<td align="right">Essay 1:</td>
				<td></td>
				<td align="left">What improvements would you suggest for this course?</td>
			</tr>
			<tr>
				<td></td>
				<td align="right"></td>
				<td align="left" class="essay_responses">1. The class was not good</td>
			</tr>
			<tr>
				<td></td>
				<td align="right"></td>
				<td align="left" class="essay_responses">2. There is no hope for you.</td>
			</tr>	
			<tr>
				<td></td>
				<td align="right"></td>
				<td align="left" class="essay_responses">3. Another question answered</td>
			</tr>	
			<tr>
				<td></td>			
				<td align="right"></td>
				<td align="left" class="essay_responses">4. Responses go here</td>
			</tr>				
		
		</table>	
	</div>
	
    <div class="footer">
    	&copy 2013 Weber State University
    <div>	

 </div>

</body>
</html>